package com.RMP
{
    import flash.display.*;
    import flash.events.*;
    import com.greensock.*;

    public class TypeShell extends Sprite
    {
        var currFilterId:int;
        var startIndexChar:String;
        var myXMLList:XMLList;
        var counter:int;
        var shortTextArray:Array;
        var pFAPos:int;
        var fadeSpeed:Number;
        var questionText:ShortText;
        var filterList:XMLList;
        public var coverSprite:Sprite;
        var navNamesArray:Array;
        public var hoverImage:HoverImage;
        var currNavId:int;
        var myRoot:MovieClip;
        var shortText:ShortText;
        var startIndexNum:int;
        var navArray:Array;

        public function TypeShell(param1:MovieClip, param2:Number, param3:XMLList, param4:int) : void
        {
            filterList = new XMLList("");
            myRoot = param1;
            fadeSpeed = param2;
            myXMLList = param3;
            startIndexNum = param4;
            currNavId = 1;
            init();
            myRoot.stage.addEventListener(Event.RESIZE, onResizer);
            doResize();
            return;
        }

        function buildCoverSprite() : void
        {
            coverSprite = new Sprite();
            coverSprite.graphics.beginFill(16777215, 100);
            coverSprite.graphics.drawRect(0, 0, 1, 1);
            coverSprite.graphics.endFill();
            coverSprite.buttonMode = true;
            coverSprite.useHandCursor = false;
            coverSprite.alpha = 0;
            coverSprite.visible = false;
            addChild(coverSprite);
            return;
        }

        function init() : void
        {
            filterList = myRoot.filterList;
            buildList();
            navNamesArray = myRoot.globalFiltersArray;
            navArray = new Array();
            buildNav();
            switchFilters();
            buildCoverSprite();
            hoverImage = new HoverImage(myRoot, fadeSpeed);
            addChild(hoverImage);
            addEventListener(Event.ENTER_FRAME, enterFrameListener, false, 0, true);
            return;
        }

        public function removeListeners() : void
        {
            removeEventListener(Event.ENTER_FRAME, enterFrameListener);
            return;
        }

        function navClick(event:MouseEvent) : void
        {
            var _loc_2:int = 0;
            currNavId = event.currentTarget.idNum;
            myRoot.projFiltersArray[pFAPos] = navNamesArray[currNavId];
            if (filterList == new XMLList("<myFilter title=\"Off\" id=\"\"/>"))
            {
                filterList = new XMLList("");
            }
            if (filterList..@title.contains(navNamesArray[currNavId]))
            {
                _loc_2 = 0;
                while (_loc_2 < filterList.length())
                {
                    
                    if (filterList[_loc_2].@title == navNamesArray[currNavId])
                    {
                        delete filterList[_loc_2];
                        if (filterList.length() == 0)
                        {
                            filterList = new XMLList("<myFilter title=\"Off\" id=\"\"/>");
                        }
                    }
                    _loc_2++;
                }
            }
            else
            {
                switch(navNamesArray[currNavId])
                {
                    case "Off":
                    {
                        filterList = new XMLList("<myFilter title=\"Off\" id=\"\"/>");
                        break;
                    }
                    case "Sketches":
                    {
                        filterList = filterList + <myFilter title="Sketches" id="6"/>;
                        break;
                    }
                    case "Drawings":
                    {
                        filterList = filterList + <myFilter title="Drawings" id="5"/>;
                        break;
                    }
                    case "Models":
                    {
                        filterList = filterList + <myFilter title="Models" id="1"/>;
                        break;
                    }
                    case "Renderings":
                    {
                        filterList = filterList + <myFilter title="Renderings" id="3"/>;
                        break;
                    }
                    case "Construction":
                    {
                        filterList = filterList + <myFilter title="Construction" id="0"/>;
                        break;
                    }
                    case "Photography":
                    {
                        filterList = filterList + <myFilter title="Photography" id="2"/>;
                        break;
                    }
                    case "Video":
                    {
                        filterList = filterList + <myFilter title="Video" id="7"/>;
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            myRoot.filterList = filterList;
            switchFilters();
            return;
        }

        function doResize() : void
        {
            var _loc_1:int = 0;
            var _loc_2:int = 0;
            if (coverSprite != null)
            {
                coverSprite.x = Math.round(4 * (myRoot.unitW + myRoot.gutterW));
                coverSprite.y = 0;
                coverSprite.width = 8 * (myRoot.unitW + myRoot.gutterW);
                coverSprite.height = 4 * (myRoot.unitH + myRoot.gutterH);
            }
            _loc_1 = 0;
            while (_loc_1 < counter)
            {
                
                if (shortTextArray[_loc_1] != undefined)
                {
                    var _loc_3:* = myRoot.unitW / 75;
                    shortTextArray[_loc_1].field.scaleY = myRoot.unitW / 75;
                    shortTextArray[_loc_1].field.scaleX = _loc_3;
                    if (shortTextArray[_loc_1].btnOver != null)
                    {
                        shortTextArray[_loc_1].btnOver.width = Math.round(4 * (myRoot.unitW + myRoot.gutterW));
                        shortTextArray[_loc_1].btnOver.height = shortTextArray[_loc_1].field.height;
                    }
                    if (_loc_1 <= 34)
                    {
                        shortTextArray[_loc_1].x = Math.round(4 * (myRoot.unitW + myRoot.gutterW));
                        shortTextArray[_loc_1].y = Math.round(_loc_1 * 14 * myRoot.unitW / 75);
                    }
                    else
                    {
                        shortTextArray[_loc_1].x = Math.round(8 * (myRoot.unitW + myRoot.gutterW));
                        shortTextArray[_loc_1].y = Math.round((_loc_1 - 35) * 14 * myRoot.unitW / 75);
                    }
                }
                _loc_1++;
            }
            _loc_2 = 0;
            while (_loc_2 < navArray.length)
            {
                
                var _loc_3:* = myRoot.unitW / 75;
                navArray[_loc_2].field.scaleY = myRoot.unitW / 75;
                navArray[_loc_2].field.scaleX = _loc_3;
                navArray[_loc_2].y = Math.round(_loc_2 * 14 * myRoot.unitW / 75);
                navArray[_loc_2].btnOver.width = Math.round(2 * (myRoot.unitW + myRoot.gutterW));
                navArray[_loc_2].btnOver.height = navArray[_loc_2].field.height;
                _loc_2++;
            }
            var _loc_3:* = myRoot.unitW / 75;
            navArray[(navArray.length - 1)].field.scaleY = myRoot.unitW / 75;
            navArray[(navArray.length - 1)].field.scaleX = _loc_3;
            navArray[(navArray.length - 1)].y = Math.round(navArray.length * 14 * myRoot.unitW / 75);
            navArray[(navArray.length - 1)].btnOver.width = Math.round(2 * (myRoot.unitW + myRoot.gutterW));
            navArray[(navArray.length - 1)].btnOver.height = navArray[(navArray.length - 1)].field.height;
            var _loc_3:* = myRoot.unitW / 75;
            questionText.field.scaleY = myRoot.unitW / 75;
            questionText.field.scaleX = _loc_3;
            questionText.y = navArray[(navArray.length - 1)].y;
            return;
        }

        function buildList() : void
        {
            var startPoint:*;
            var XMLlength:int;
            var i:int;
            var myLabel:String;
            startPoint = (startIndexNum - 1) * 70;
            counter = 0;
            shortTextArray = new Array();
            XMLlength = myXMLList.item.length();
            i = startPoint;
            while (i < XMLlength)
            {
                
                myLabel = myXMLList.item[i].@label;
                shortTextArray[counter] = new ShortText(myRoot, myLabel, counter);
                if (myRoot.pathNames[1] == "architecture")
                {
                    trace("ARCH");
                    var _loc_3:int = 0;
                    var _loc_6:int = 0;
                    var _loc_9:int = 0;
                    var _loc_10:* = myRoot.myXML.nav.projects.tier0;
                    var _loc_8:* = new XMLList("");
                    for each (_loc_11 in _loc_10)
                    {
                        
                        var _loc_12:* = _loc_10[_loc_9];
                        with (_loc_10[_loc_9])
                        {
                            if (@label == "Architecture")
                            {
                                _loc_8[_loc_9] = _loc_11;
                            }
                        }
                    }
                    var _loc_7:* = _loc_8.tier1;
                    var _loc_5:* = new XMLList("");
                    for each (_loc_8 in _loc_7)
                    {
                        
                        var _loc_9:* = _loc_7[_loc_6];
                        with (_loc_7[_loc_6])
                        {
                            if (@label == "Name")
                            {
                                _loc_5[_loc_6] = _loc_8;
                            }
                        }
                    }
                    var _loc_4:* = _loc_5.tier2.item;
                    var _loc_2:* = new XMLList("");
                    for each (_loc_5 in _loc_4)
                    {
                        
                        var _loc_6:* = _loc_4[_loc_3];
                        with (_loc_4[_loc_3])
                        {
                            if (@id == myXMLList.item[i].@id)
                            {
                                _loc_2[_loc_3] = _loc_5;
                            }
                        }
                    }
                    shortTextArray[counter].myXMLList = new XML(_loc_2);
                }
                else if (myRoot.pathNames[1] == "products")
                {
                    var _loc_3:int = 0;
                    var _loc_6:int = 0;
                    var _loc_9:int = 0;
                    var _loc_10:* = myRoot.myXML.nav.projects.tier0;
                    var _loc_8:* = new XMLList("");
                    for each (_loc_11 in _loc_10)
                    {
                        
                        var _loc_12:* = _loc_10[_loc_9];
                        with (_loc_10[_loc_9])
                        {
                            if (@label == "Products")
                            {
                                _loc_8[_loc_9] = _loc_11;
                            }
                        }
                    }
                    var _loc_7:* = _loc_8.tier1;
                    var _loc_5:* = new XMLList("");
                    for each (_loc_8 in _loc_7)
                    {
                        
                        var _loc_9:* = _loc_7[_loc_6];
                        with (_loc_7[_loc_6])
                        {
                            if (@label == "Name")
                            {
                                _loc_5[_loc_6] = _loc_8;
                            }
                        }
                    }
                    var _loc_4:* = _loc_5.tier2.item;
                    var _loc_2:* = new XMLList("");
                    for each (_loc_5 in _loc_4)
                    {
                        
                        var _loc_6:* = _loc_4[_loc_3];
                        with (_loc_4[_loc_3])
                        {
                            if (@id == myXMLList.item[i].@id)
                            {
                                _loc_2[_loc_3] = _loc_5;
                            }
                        }
                    }
                    shortTextArray[counter].myXMLList = new XML(_loc_2);
                }
                else if (myRoot.pathNames[1] == "exhibitions")
                {
                    var _loc_3:int = 0;
                    var _loc_6:int = 0;
                    var _loc_9:int = 0;
                    var _loc_10:* = myRoot.myXML.nav.projects.tier0;
                    var _loc_8:* = new XMLList("");
                    for each (_loc_11 in _loc_10)
                    {
                        
                        var _loc_12:* = _loc_10[_loc_9];
                        with (_loc_10[_loc_9])
                        {
                            if (@label == "Exhibitions")
                            {
                                _loc_8[_loc_9] = _loc_11;
                            }
                        }
                    }
                    var _loc_7:* = _loc_8.tier1;
                    var _loc_5:* = new XMLList("");
                    for each (_loc_8 in _loc_7)
                    {
                        
                        var _loc_9:* = _loc_7[_loc_6];
                        with (_loc_7[_loc_6])
                        {
                            if (@label == "Name")
                            {
                                _loc_5[_loc_6] = _loc_8;
                            }
                        }
                    }
                    var _loc_4:* = _loc_5.tier2.item;
                    var _loc_2:* = new XMLList("");
                    for each (_loc_5 in _loc_4)
                    {
                        
                        var _loc_6:* = _loc_4[_loc_3];
                        with (_loc_4[_loc_3])
                        {
                            if (@id == myXMLList.item[i].@id)
                            {
                                _loc_2[_loc_3] = _loc_5;
                            }
                        }
                    }
                    shortTextArray[counter].myXMLList = new XML(_loc_2);
                }
                shortTextArray[counter].addEventListener(MouseEvent.MOUSE_OVER, btnRollOver, false, 0, true);
                shortTextArray[counter].addEventListener(MouseEvent.MOUSE_OUT, btnRollOut, false, 0, true);
                shortTextArray[counter].addEventListener(MouseEvent.CLICK, btnClick, false, 0, true);
                addChild(shortTextArray[counter]);
                var _loc_3:* = counter + 1;
                counter = _loc_3;
                trace("counter " + counter);
                if (counter == 70)
                {
                    break;
                }
                i = (i + 1);
            }
            return;
        }

        function switchFilters() : void
        {
            var _loc_1:int = 0;
            var _loc_2:int = 0;
            var _loc_3:* = undefined;
            var _loc_4:int = 0;
            var _loc_5:Boolean = false;
            var _loc_6:int = 0;
            _loc_1 = navArray.length;
            _loc_2 = 1;
            while (_loc_2 < _loc_1)
            {
                
                if (filterList..@title.contains(navArray[_loc_2].field.text))
                {
                    TweenMax.to(navArray[_loc_2], 0, {tint:myRoot.hotColor, overwrite:true});
                }
                else
                {
                    TweenMax.to(navArray[_loc_2], fadeSpeed, {tint:12500670, overwrite:true});
                }
                _loc_2++;
            }
            _loc_3 = shortTextArray.length;
            _loc_4 = 0;
            while (_loc_4 < _loc_3)
            {
                
                if (shortTextArray[_loc_4] != undefined)
                {
                    if (shortTextArray[_loc_4].objName == "ShortText")
                    {
                        if (filterList..@title == "Off")
                        {
                            TweenMax.to(shortTextArray[_loc_4], fadeSpeed / 2, {tint:myRoot.coldColor, overwrite:true});
                        }
                        else
                        {
                            _loc_5 = true;
                            _loc_6 = 0;
                            while (_loc_6 < filterList.length())
                            {
                                
                                if (shortTextArray[_loc_4].checkFilters(filterList[_loc_6].@id) != true)
                                {
                                    _loc_5 = false;
                                    break;
                                }
                                _loc_6++;
                            }
                            if (_loc_5 == true)
                            {
                                TweenMax.to(shortTextArray[_loc_4], fadeSpeed / 2, {tint:myRoot.hotColor, overwrite:true});
                            }
                            else
                            {
                                TweenMax.to(shortTextArray[_loc_4], fadeSpeed / 2, {tint:myRoot.coldColor, overwrite:true});
                            }
                        }
                    }
                }
                _loc_4++;
            }
            return;
        }

        function navRollOver(event:MouseEvent) : void
        {
            TweenMax.to(event.currentTarget, fadeSpeed, {tint:myRoot.hotColor, overwrite:true});
            return;
        }

        function enterFrameListener(event:Event) : void
        {
            var _loc_2:* = undefined;
            hoverImage.width = Math.round(2 * myRoot.unitW + myRoot.gutterW);
            hoverImage.height = Math.round(myRoot.unitH);
            _loc_2 = Math.round(mouseY - hoverImage.height / 2);
            if (_loc_2 <= 2)
            {
                _loc_2 = 2;
            }
            else if (_loc_2 >= Math.round(3 * (myRoot.unitH + myRoot.gutterH)) + 2)
            {
                _loc_2 = Math.round(3 * (myRoot.unitH + myRoot.gutterH)) + 2;
            }
            hoverImage.x = Math.round(2 * (myRoot.unitW + myRoot.gutterW));
            hoverImage.y = _loc_2;
            if (mouseX > 4 * myRoot.unitW + 3 * myRoot.gutterW && mouseX < 12 * myRoot.unitW + 11 * myRoot.gutterW && mouseY > 0 && mouseY < 4 * myRoot.unitH + 4 * myRoot.gutterH)
            {
                if (hoverImage.alpha != 1)
                {
                    TweenMax.to(hoverImage, fadeSpeed / 4, {alpha:1, overwrite:true});
                }
            }
            else if (hoverImage.alpha != 0)
            {
                TweenMax.to(hoverImage, fadeSpeed / 4, {alpha:0, overwrite:true});
            }
            return;
        }

        function onResizer(event:Event)
        {
            doResize();
            return;
        }

        function btnRollOver(event:MouseEvent) : void
        {
            hoverImage.loadNewImage(event.currentTarget.myXMLList.thumbnails.@small);
            hoverImage.x = Math.round(2 * (myRoot.unitW + myRoot.gutterW));
            TweenMax.to(event.currentTarget, fadeSpeed, {tint:0, overwrite:true});
            return;
        }

        function btnRollOut(event:MouseEvent) : void
        {
            var _loc_2:Boolean = false;
            var _loc_3:int = 0;
            if (filterList == new XMLList("<myFilter title=\"Off\" id=\"\"/>"))
            {
                TweenMax.to(event.currentTarget, fadeSpeed, {tint:myRoot.coldColor, overwrite:true});
            }
            else
            {
                _loc_2 = true;
                _loc_3 = 0;
                while (_loc_3 < filterList.length())
                {
                    
                    if (event.currentTarget.checkFilters(filterList[_loc_3].@id) != true)
                    {
                        _loc_2 = false;
                        break;
                    }
                    _loc_3++;
                }
                if (_loc_2 == true)
                {
                    TweenMax.to(event.currentTarget, fadeSpeed, {tint:myRoot.hotColor, overwrite:true});
                }
                else
                {
                    TweenMax.to(event.currentTarget, fadeSpeed, {tint:myRoot.coldColor, overwrite:true});
                }
            }
            return;
        }

        function questionOut(event:MouseEvent) : void
        {
            TweenMax.to(event.currentTarget, fadeSpeed, {tint:12500670, overwrite:true});
            TweenMax.to(questionText, fadeSpeed, {tint:12500670, alpha:0, overwrite:true});
            return;
        }

        function btnClick(event:MouseEvent) : void
        {
            updateAddress(event.currentTarget.myXMLList.@id);
            return;
        }

        function buildNav() : void
        {
            var filtersXML:XMLList;
            var i:int;
            pFAPos = 0;
            filtersXML = new XMLList(myRoot.myXML.filters.filter);
            i;
            while (i < navNamesArray.length)
            {
                
                if (i > 0)
                {
                    var _loc_3:int = 0;
                    var _loc_4:* = filtersXML;
                    var _loc_2:* = new XMLList("");
                    for each (_loc_5 in _loc_4)
                    {
                        
                        var _loc_6:* = _loc_4[_loc_3];
                        with (_loc_4[_loc_3])
                        {
                            if (@label == navNamesArray[i])
                            {
                                _loc_2[_loc_3] = _loc_5;
                            }
                        }
                    }
                    navArray[i] = new NavText(myRoot, navNamesArray[i], i, "0xBEBEBE", _loc_2.@id);
                    navArray[i].addEventListener(MouseEvent.MOUSE_OVER, navRollOver, false, 0, true);
                    navArray[i].addEventListener(MouseEvent.MOUSE_OUT, navRollOut, false, 0, true);
                    navArray[i].addEventListener(MouseEvent.CLICK, navClick, false, 0, true);
                }
                else
                {
                    navArray[i] = new NavTextBold(myRoot, navNamesArray[i], i, myRoot.coldColor, 0);
                    navArray[i].btn.useHandCursor = false;
                    navArray[i].btn.mouseEnabled = false;
                    navArray[i].btn.buttonMode = false;
                }
                addChild(navArray[i]);
                i = (i + 1);
            }
            navArray[navNamesArray.length] = new NavText(myRoot, "?", i, "0xBEBEBE", navNamesArray.length);
            navArray[navNamesArray.length].addEventListener(MouseEvent.MOUSE_OVER, questionOver, false, 0, true);
            navArray[navNamesArray.length].addEventListener(MouseEvent.MOUSE_OUT, questionOut, false, 0, true);
            addChild(navArray[navNamesArray.length]);
            questionText = new ShortText(myRoot, "    Use filters to identify media types in each project", 0);
            questionText.mouseEnabled = false;
            questionText.mouseChildren = false;
            questionText.buttonMode = false;
            questionText.useHandCursor = false;
            TweenMax.to(questionText, 0, {tint:12500670, overwrite:true});
            questionText.alpha = 0;
            addChild(questionText);
            return;
        }

        function questionOver(event:MouseEvent) : void
        {
            TweenMax.to(event.currentTarget, fadeSpeed, {tint:7829367, overwrite:true});
            TweenMax.to(questionText, fadeSpeed, {tint:7829367, alpha:1, overwrite:true});
            return;
        }

        function updateAddress(param1) : void
        {
            var incomingId:* = param1;
            switch(myRoot.pathNames[1])
            {
                case "architecture":
                {
                    switch(myRoot.pathNames[2])
                    {
                        case "type":
                        {
                            var _loc_4:int = 0;
                            var _loc_7:int = 0;
                            var _loc_10:int = 0;
                            var _loc_11:* = myRoot.myXML.nav.projects.tier0;
                            var _loc_9:* = new XMLList("");
                            for each (_loc_12 in _loc_11)
                            {
                                
                                var _loc_13:* = _loc_11[_loc_10];
                                with (_loc_11[_loc_10])
                                {
                                    if (@label == "Architecture")
                                    {
                                        _loc_9[_loc_10] = _loc_12;
                                    }
                                }
                            }
                            var _loc_8:* = _loc_9.tier1;
                            var _loc_6:* = new XMLList("");
                            for each (_loc_9 in _loc_8)
                            {
                                
                                var _loc_10:* = _loc_8[_loc_7];
                                with (_loc_8[_loc_7])
                                {
                                    if (@label == "Name")
                                    {
                                        _loc_6[_loc_7] = _loc_9;
                                    }
                                }
                            }
                            var _loc_5:* = _loc_6.tier2.item;
                            var _loc_3:* = new XMLList("");
                            for each (_loc_6 in _loc_5)
                            {
                                
                                var _loc_7:* = _loc_5[_loc_4];
                                with (_loc_5[_loc_4])
                                {
                                    if (@id == incomingId)
                                    {
                                        _loc_3[_loc_4] = _loc_6;
                                    }
                                }
                            }
                            if (_loc_3.@sub == "T")
                            {
                                myRoot.clickPathNames = ["projects", "architecture", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], incomingId, "sub", 0, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                            }
                            else
                            {
                                myRoot.clickPathNames = ["projects", "architecture", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], incomingId, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + incomingId + "/" + 0 + "/");
                            }
                            break;
                        }
                        case "date":
                        {
                            var _loc_4:int = 0;
                            var _loc_7:int = 0;
                            var _loc_10:int = 0;
                            var _loc_11:* = myRoot.myXML.nav.projects.tier0;
                            var _loc_9:* = new XMLList("");
                            for each (_loc_12 in _loc_11)
                            {
                                
                                var _loc_13:* = _loc_11[_loc_10];
                                with (_loc_11[_loc_10])
                                {
                                    if (@label == "Architecture")
                                    {
                                        _loc_9[_loc_10] = _loc_12;
                                    }
                                }
                            }
                            var _loc_8:* = _loc_9.tier1;
                            var _loc_6:* = new XMLList("");
                            for each (_loc_9 in _loc_8)
                            {
                                
                                var _loc_10:* = _loc_8[_loc_7];
                                with (_loc_8[_loc_7])
                                {
                                    if (@label == "Name")
                                    {
                                        _loc_6[_loc_7] = _loc_9;
                                    }
                                }
                            }
                            var _loc_5:* = _loc_6.tier2.item;
                            var _loc_3:* = new XMLList("");
                            for each (_loc_6 in _loc_5)
                            {
                                
                                var _loc_7:* = _loc_5[_loc_4];
                                with (_loc_5[_loc_4])
                                {
                                    if (@id == incomingId)
                                    {
                                        _loc_3[_loc_4] = _loc_6;
                                    }
                                }
                            }
                            if (_loc_3.@sub == "T")
                            {
                                myRoot.clickPathNames = ["projects", "architecture", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], incomingId, "sub", 0, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                            }
                            else
                            {
                                myRoot.clickPathNames = ["projects", "architecture", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], incomingId, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + incomingId + "/" + 0 + "/");
                            }
                            break;
                        }
                        case "location":
                        {
                            var _loc_4:int = 0;
                            var _loc_7:int = 0;
                            var _loc_10:int = 0;
                            var _loc_11:* = myRoot.myXML.nav.projects.tier0;
                            var _loc_9:* = new XMLList("");
                            for each (_loc_12 in _loc_11)
                            {
                                
                                var _loc_13:* = _loc_11[_loc_10];
                                with (_loc_11[_loc_10])
                                {
                                    if (@label == "Architecture")
                                    {
                                        _loc_9[_loc_10] = _loc_12;
                                    }
                                }
                            }
                            var _loc_8:* = _loc_9.tier1;
                            var _loc_6:* = new XMLList("");
                            for each (_loc_9 in _loc_8)
                            {
                                
                                var _loc_10:* = _loc_8[_loc_7];
                                with (_loc_8[_loc_7])
                                {
                                    if (@label == "Name")
                                    {
                                        _loc_6[_loc_7] = _loc_9;
                                    }
                                }
                            }
                            var _loc_5:* = _loc_6.tier2.item;
                            var _loc_3:* = new XMLList("");
                            for each (_loc_6 in _loc_5)
                            {
                                
                                var _loc_7:* = _loc_5[_loc_4];
                                with (_loc_5[_loc_4])
                                {
                                    if (@id == incomingId)
                                    {
                                        _loc_3[_loc_4] = _loc_6;
                                    }
                                }
                            }
                            if (_loc_3.@sub == "T")
                            {
                                myRoot.clickPathNames = ["projects", "architecture", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], myRoot.pathNames[5], incomingId, "sub", 0, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + myRoot.pathNames[5] + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                            }
                            else
                            {
                                myRoot.clickPathNames = ["projects", "architecture", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], myRoot.pathNames[5], incomingId, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "architecture" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + myRoot.pathNames[5] + "/" + incomingId + "/" + 0 + "/");
                            }
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                    break;
                }
                case "products":
                {
                    switch(myRoot.pathNames[2])
                    {
                        case "type":
                        {
                            var _loc_4:int = 0;
                            var _loc_7:int = 0;
                            var _loc_10:int = 0;
                            var _loc_11:* = myRoot.myXML.nav.projects.tier0;
                            var _loc_9:* = new XMLList("");
                            for each (_loc_12 in _loc_11)
                            {
                                
                                var _loc_13:* = _loc_11[_loc_10];
                                with (_loc_11[_loc_10])
                                {
                                    if (@label == "Products")
                                    {
                                        _loc_9[_loc_10] = _loc_12;
                                    }
                                }
                            }
                            var _loc_8:* = _loc_9.tier1;
                            var _loc_6:* = new XMLList("");
                            for each (_loc_9 in _loc_8)
                            {
                                
                                var _loc_10:* = _loc_8[_loc_7];
                                with (_loc_8[_loc_7])
                                {
                                    if (@label == "Name")
                                    {
                                        _loc_6[_loc_7] = _loc_9;
                                    }
                                }
                            }
                            var _loc_5:* = _loc_6.tier2.item;
                            var _loc_3:* = new XMLList("");
                            for each (_loc_6 in _loc_5)
                            {
                                
                                var _loc_7:* = _loc_5[_loc_4];
                                with (_loc_5[_loc_4])
                                {
                                    if (@id == incomingId)
                                    {
                                        _loc_3[_loc_4] = _loc_6;
                                    }
                                }
                            }
                            if (_loc_3.@sub == "T")
                            {
                                myRoot.clickPathNames = ["projects", "products", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], incomingId, "sub", 0, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "products" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                            }
                            else
                            {
                                myRoot.clickPathNames = ["projects", "products", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], incomingId, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "products" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + incomingId + "/" + 0 + "/");
                            }
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                    break;
                }
                case "exhibitions":
                {
                    switch(myRoot.pathNames[2])
                    {
                        case "location":
                        {
                            var _loc_4:int = 0;
                            var _loc_7:int = 0;
                            var _loc_10:int = 0;
                            var _loc_11:* = myRoot.myXML.nav.projects.tier0;
                            var _loc_9:* = new XMLList("");
                            for each (_loc_12 in _loc_11)
                            {
                                
                                var _loc_13:* = _loc_11[_loc_10];
                                with (_loc_11[_loc_10])
                                {
                                    if (@label == "Exhibitions")
                                    {
                                        _loc_9[_loc_10] = _loc_12;
                                    }
                                }
                            }
                            var _loc_8:* = _loc_9.tier1;
                            var _loc_6:* = new XMLList("");
                            for each (_loc_9 in _loc_8)
                            {
                                
                                var _loc_10:* = _loc_8[_loc_7];
                                with (_loc_8[_loc_7])
                                {
                                    if (@label == "Name")
                                    {
                                        _loc_6[_loc_7] = _loc_9;
                                    }
                                }
                            }
                            var _loc_5:* = _loc_6.tier2.item;
                            var _loc_3:* = new XMLList("");
                            for each (_loc_6 in _loc_5)
                            {
                                
                                var _loc_7:* = _loc_5[_loc_4];
                                with (_loc_5[_loc_4])
                                {
                                    if (@id == incomingId)
                                    {
                                        _loc_3[_loc_4] = _loc_6;
                                    }
                                }
                            }
                            if (_loc_3.@sub == "T")
                            {
                                myRoot.clickPathNames = ["projects", "exhibitions", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], myRoot.pathNames[5], incomingId, "sub", 0, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "exhibitions" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + myRoot.pathNames[5] + "/" + incomingId + "/" + "sub" + "/" + 0 + "/" + 0 + "/");
                            }
                            else
                            {
                                myRoot.clickPathNames = ["projects", "exhibitions", myRoot.pathNames[2], myRoot.pathNames[3], myRoot.pathNames[4], myRoot.pathNames[5], incomingId, 0];
                                myRoot.updateAddress("/" + "projects" + "/" + "exhibitions" + "/" + myRoot.pathNames[2] + "/" + myRoot.pathNames[3] + "/" + myRoot.pathNames[4] + "/" + myRoot.pathNames[5] + "/" + incomingId + "/" + 0 + "/");
                            }
                            break;
                        }
                        default:
                        {
                            break;
                        }
                    }
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }

        function navRollOut(event:MouseEvent) : void
        {
            if (filterList..@title.contains(event.currentTarget.field.text))
            {
                TweenMax.to(event.currentTarget, fadeSpeed, {tint:myRoot.hotColor, overwrite:true});
            }
            else
            {
                TweenMax.to(event.currentTarget, fadeSpeed, {tint:12500670, overwrite:true});
            }
            return;
        }

    }
}
